home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / demos / formattimedemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-08  |  2.5 KB  |  67 lines

  1. {
  2. GPC demo program for the FormatTime function.
  3.  
  4. Copyright (C) 2000-2001 Free Software Foundation, Inc.
  5.  
  6. Author: Frank Heckenbach <frank@pascal.gnu.de>
  7.  
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License as
  10. published by the Free Software Foundation, version 2.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; see the file COPYING. If not, write to
  19. the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.
  21.  
  22. As a special exception, if you incorporate even large parts of the
  23. code of this demo program into another program with substantially
  24. different functionality, this does not cause the other program to
  25. be covered by the GNU General Public License. This exception does
  26. not however invalidate any other reasons why it might be covered
  27. by the GNU General Public License.
  28. }
  29.  
  30. program FormatTimeDemo;
  31.  
  32. uses GPC;
  33.  
  34. const
  35.   TestFormat =
  36.     'Some examples of formatting the current date and time using `FormatTime''.%n%n' +
  37.     '(Note: Some of the formats are locale-dependent, so you might have to%n' +
  38.     'set $LANG or $LC_TIME if you don''t get the right results for your country.)%n%n' +
  39.     'Default date/time format:     %c%n' +
  40.     'Default date format:          %x%n' +
  41.     'Default time format:          %X%n' +
  42.     'Alternative date/time format: %Ec%n' +
  43.     'Alternative date format:      %Ex%n' +
  44.     'Alternative time format:      %EX%n' +
  45.     'Date (ISO format):            %F%n' +
  46.     'Date (American format):       %D%n' +
  47.     'Date (German format):         %^/2a %-e.%-m.%Y%n' +
  48.     'Day of year:                  %j%n' +
  49.     'Weekday:                      %A (short: %a)%n' +
  50.     'Month:                        %B (short: %b)%n' +
  51.     'ISO week:                     %V/%G%n' +
  52.     'Time (24 hour format):        %T%n' +
  53.     'Time (AM/PM format):          %I:%M:%S %p%n' +
  54.     '1/100 seconds:                %2Q%n' +
  55.     'Unix time:                    %s.%Q%n' +
  56.     'Time zone (symbolic):         %Z%n' +
  57.     'Time zone (numeric):          %z%n' +
  58.     'RFC 822 timestamp:            %a, %d %b %Y %T %z%n';
  59.  
  60. var
  61.   CurrentTime : TimeStamp;
  62.  
  63. begin
  64.   GetTimeStamp (CurrentTime);
  65.   Writeln (FormatTime (CurrentTime, TestFormat))
  66. end.
  67.